#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
#define maxn 1005
#define maxbit 10000

int n;
struct Minister {
    int a,b;
    bool operator< (Minister m){
        return this->a*this->b < m.a*m.b;
    }
}minister[maxn];
int multians[maxn][maxbit];
int ans[maxn][maxbit];
int maxindex=0;

void multiply(int *dest, int *a, int b){
    int carry=0;
    for(int i=0;i<maxbit;i++){
        dest[i] = a[i]*b;
        dest[i] += carry;
        carry = dest[i]/10;
        dest[i] %= 10;
    }
}
void divide(int *dest, int *a, int b){
    int carry=0;
    for(int i=maxbit-1;i>=0;i--){
        carry *= 10;
        dest[i] = a[i]+carry;
        carry = dest[i]%b;
        dest[i] = dest[i]/b;
    }
}
void add(int *a, int b){
    a[0] += b;
    int carry=0;
    for(int i=0;i<maxbit;i++){
        a[i] += carry%10;
        carry /= 10;
    }
}

bool greaterans(int index){
    for(int i=maxbit-1;i>=0;i--){
        if(ans[index][i] > ans[maxindex][i]) return true;
        else if(ans[index][i]==ans[maxindex][i]) continue;
        else return false;
    }
}

void displaymaxans(){
    bool begincout=false;
    for(int i=maxbit-1;i>=0;i--){
        if(begincout || ans[maxindex][i]!=0){
            cout<<ans[maxindex][i];
            begincout=true;
        }
    }
    if(!begincout) cout<<"0"<<endl;
}

int main(){
    cin>>n;
    cin>>minister[0].a>>minister[0].b;
    for(int i=1;i<=n;i++)
        cin>>minister[i].a>>minister[i].b;

    sort(minister+1, minister+n+1);
    add(multians[0], minister[0].a);
    for(int i=1;i<=n;i++){
        multiply(multians[i], multians[i-1], minister[i].a);
        divide(ans[i], multians[i-1], minister[i].b);
        if(greaterans(i)) maxindex=i;
    }
    displaymaxans();
    return 0;
}
